package com.edu.cq02.controller;



import com.edu.cq02.pojo.Product;
import com.edu.cq02.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class RestTestController {
    @RequestMapping("getUserByrest")
    public User getUser() {
        User user = new User();
        user.setUsername("张三");
        user.setPassword("1111");
        return user;
    }

    @RequestMapping("addProductsByrest")
    public List<Product> addProducts() {
        Product p1 = new Product();
        p1.setProId("p001");
        p1.setProName("红牛");
        Product p2 = new Product();
        p2.setProId("p002");
        p2.setProName("三文鱼");
        ArrayList<Product> products = new ArrayList<>();
        products.add(p1);
        products.add(p2);
        return products;
    }

}

